﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Data.SqlClient;
using WindowsFormsApplication2.All_FORMS.Main_forms;
using System.Threading;

namespace WindowsFormsApplication2
{
    static class Program
    {
        static string s= "ADMIN";
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            string connStr = "Persist Security Info=False; Integrated Security=true; Initial Catalog=tosol; Server=JOY-PC\\SQL";
            SqlConnection conn = new SqlConnection(connStr);
            conn.Open();

            
            Application.EnableVisualStyles();
           // 
           
            frmLogin lg = new frmLogin(conn);
            if (lg.ShowDialog() == DialogResult.OK)
            {
                s = lg.comboBox1.Text;
                Thread t = new Thread(new ThreadStart(SplashS));
                t.Start();
                Thread.Sleep(4500);
                t.Abort();
             
                
                Application.Run(new MDIParentAdmin(conn, lg.comboBox1.Text, lg.txtLoginName.Text, lg.label4.Text, lg.label5.Text));
            
            }
            
        }
        static void SplashS()
        {
            Application.Run(new Screenform(s));
        }
    }

}
